package com.todo.biz.application.frontend.controller;

import com.todo.biz.application.frontend.service.DictAggService;
import com.todo.biz.iface.frontend.DictFrontendIface;
import com.todo.biz.iface.frontend.request.QueryDictDetailParam;
import com.todo.biz.iface.frontend.response.DictDetailVO;
import com.todo.common.common.entity.response.BizResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author azhebuxing
 * @date 2024/12/9 19:25
 * @description
 */
@RestController
@RequestMapping("/tool/dict")
@Tag(name = "字典前台处理类", description = "字典前台处理类")
public class DictFrontendController implements DictFrontendIface {

    @Resource
    private DictAggService dictAggService;


    @Override
    @Operation(summary = "根据业务code和场景code查询字典详情")
    @PostMapping("/queryDictDetail")
    public BizResponse<DictDetailVO> queryDictDetail(@RequestBody QueryDictDetailParam param) {
        if (param == null) {
            return BizResponse.success("查询异常，请刷新后重新操作");
        }
        if (!param.baseCheck()) {
            return BizResponse.success("查询失败，请刷新后重新操作");
        }
        return dictAggService.queryDictDetail(param);
    }
}
